package com.spring.controller;

import com.spring.dao.BookDao;
import com.spring.dao.Impl.BookDaoImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;


/**
 * @author:CoolTiger
 * @description: TODO
 * @date:2024/04/24/23:29:45
 **/
public class App {
    public static void main(String[] args) {
        // 加载类路径下的配置文件
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        ctx.registerShutdownHook();
//        DataSource dataSource = (DataSource) ctx.getBean("dataSource");
//        System.out.println(dataSource);
        BookDao bookDao = (BookDaoImpl) ctx.getBean("bookDao");
        bookDao.save();
    }
}
